class Solution(object):
    def splitIntoFibonacci(self, num):
        """
        :type num: str
        :rtype: List[int]
        """
        n = len(num)
        if n <= 2:
            return []

        def search(num1, num2, k):
            if k == n:
                return True
            int_num1 = int(num1)
            int_num2 = int(num2)
            int_num3 = int_num1 + int_num2
            num3 = str(int_num3)
            if k + len(num3) <= n and int_num3 == int(num[k: k + len(num3)]) and int_num3 < (1 << 31):
                out_list.append(int_num3)
                return search(num2, num3, k + len(num3))
            else:
                return False
        for i in range(1, n - 1):
            if num[0] == '0':
                if i == 1:
                    if num[i] == '0':
                        out_list = [int(num[0]), int(num[1])]
                        out = search(num[0], num[1], 2)
                        if out:
                            return out_list
                        else:
                            return []
                    else:
                        for j in range(i + 1, n):
                            if int(num[1:j]) < (1 << 31):
                                out_list = [int(num[0]), int(num[1:j])]
                                out = search(num[0], num[1:j], j)
                                if out:
                                    return out_list
                        return []
            else:
                num1 = num[:i]
                if int(num1) < (1 << 31):
                    if num[i] == '0':
                        out_list = [int(num1), int(num[i])]
                        out = search(num1, num[i], i + 1)
                        if out:
                            return out_list
                    else:
                        for j in range(i + 1, n):
                            if int(num[i:j]) < (1 << 31):
                                out_list = [int(num1), int(num[i:j])]
                                out = search(num1, num[i:j], j)
                                if out:
                                    return out_list
        return []


data = Solution()
num = "539834657215398346785398346991079669377161950407626991734534318677529701785098211336528511"
print(data.splitIntoFibonacci(num))
